using UnityEngine;
using System.Collections;

public class HoleController : MonoBehaviour {
	float m_fRadius = 3.0f;
	float m_fPointValue = 3.0f;
	float m_fDeathTimer = 2.0f;
	bool m_bDestroy = false;
	Vector3 m_vPrePos;
	public float Score
	{
		get { return m_fPointValue; }
	}
	public float Radius
	{
		get { return m_fRadius; }
	}
	public void DestroyHole()
	{
		transform.FindChild("GoalEffect").particleEmitter.emit = true;
		m_bDestroy = true;
	}
	void OnDrawGizmos()
	{
		Gizmos.DrawWireSphere(transform.position, m_fRadius);
	}
	// Use this for initialization
	void Start () 
	{
		renderer.material.color = Color.black;
		m_vPrePos = transform.position;
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (m_bDestroy)
		{
			transform.position = Vector3.Lerp(transform.position, new Vector3(m_vPrePos.x, m_vPrePos.y - 5, m_vPrePos.z), Time.deltaTime );
			m_fDeathTimer -= Time.deltaTime;
			if(m_fDeathTimer <= 0.0f)
				Destroy(gameObject);
		}
	
	}
}
